package com.example.myapplication.data

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.widget.Toast

class MyBroadcastReceiver: BroadcastReceiver() {
    override fun onReceive(context: Context, intent: Intent) {
        // 在广播接收器中更新用户界面
        val extras = intent.extras ?: return
        val displayName = extras.getString("displayName") ?: return
        Toast.makeText(
            context,
            "welcome!$displayName",
            Toast.LENGTH_LONG
        ).show()
    }
}